package com.hnkywl.sts.dao.xsgl;

import com.hnkywl.sts.dao.base.RegionDao;
import com.hnkywl.sts.dao.sys.YgDao;
import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.cggl.Glfy;
import com.hnkywl.sts.entity.organ.Ck;
import com.hnkywl.sts.entity.xsgl.Dfkxsd;
import com.hnkywl.sts.entity.xsgl.Kh;
import com.hnkywl.sts.entity.xsgl.Xsd;
import com.hnkywl.sts.entity.xsgl.Xsmx;
import com.hnkywl.sts.service.sys.YgService;
import net.ruixin.orm.hibernate.Page;
import net.ruixin.orm.hibernate.SimpleHibernateTemplate;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.criterion.*;
import org.hibernate.transform.Transformers;
import org.hibernate.type.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.text.ParseException;
import java.util.*;


/**
 * Created with IntelliJ IDEA.
 * User: jerry
 * Date: 13-4-15
 * Time: 下午2:14
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class DfkxsdDao extends SimpleHibernateTemplate<Dfkxsd, Long> {

    public Dfkxsd findDfkXsdByHt(Long htId,String hth,Double je){
        String hql = " from Dfkxsd where orderId = ? and orderSn = ? and amount = ? ";
        return this.find(hql,htId,hth,je).size()==0?null:(Dfkxsd)this.find(hql,htId,hth,je).get(0);
    }

    public boolean getlocalSerialNumberOver(Long serialNumber){
        String hql = " from Dfkxsd where lockSerialNumber >= ? ";
        return this.existsQuery(hql,serialNumber);
    }

    public boolean getUnlocalSerialNumberOver(Long serialNumber){
        String hql = " from Dfkxsd where unlockSerialNumber >= ? ";
        return this.existsQuery(hql,serialNumber);
    }

}


